from django.shortcuts import render

from goods.models import GoodsCategory


def breadcrumd(cat3):

    # 拿id
    cat2 = cat3.parent
    cat1 = cat2.parent

    breadcrumb = {
        'cat1': {
            'url': cat1.goodschannel_set.all()[0].url,  # [<列表对象>]
            'name': cat1.name
        },
        'cat2': cat2,
        'cat3': cat3,
    }
    return breadcrumb